package cn.wolfcode.luowowo.search.service.impl;

import cn.wolfcode.luowowo.search.repository.QuestionRepository;
import cn.wolfcode.luowowo.search.repository.UserInfoRepository;
import cn.wolfcode.luowowo.search.service.IQuestionSearchService;
import cn.wolfcode.luowowo.search.service.IUserInfoSearchService;
import cn.wolfcode.luowowo.search.template.QuestionTemplate;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;

import java.util.List;

@Service
public class QuestionSearchServiceImpl implements IQuestionSearchService {
    @Autowired
    private QuestionRepository questionRepository;
    @Autowired
    private ElasticsearchTemplate template;

    /**
     * 添加或编辑
     * @param template
     */
    @Override
    public void saveOrUpdate(QuestionTemplate template) {
        questionRepository.save(template);
    }

    @Override
    public List<QuestionTemplate> findByName(String name) {
        return questionRepository.findByDestName(name);
    }
}
